Feature/engine support (Issue #11)#12
Conversation
…r both mounted engines & the app itself
|
This is really cool :) |
There was a problem hiding this comment.
This hack is pretty neat, but isn't there any other way to iterate through all the engines other than that? Also, I think this only works if spinach is loaded after all the other Engines am I right?
If that's the case, maybe this code should be initialized someplace here:
https://github.com/codegram/spinach-rails/blob/master/lib/spinach-rails/railtie.rb#L12
There should be a way to be sure we're the last gem to be initialized.
Or did I get something wrong?
There was a problem hiding this comment.
Ok, I see you actually mentioned this on the Issue 👍
Do you have the time to maybe tackle the problem from the Railtie and we can then merge it into master?
There was a problem hiding this comment.
Would love to... Maybe you also noticed the engine is installed into vendor/plugins, support for which will be removed in Rails 4. May want to address that prior to merging, also.
There was a problem hiding this comment.
@rthbound ObjectSpace is disabled by default in JRuby. I don't think it's a very good idea to use it if we plan to keep our cross-implementation support.
There was a problem hiding this comment.
@txus
Totally fair. It's a handy hack, but agreeably not a solution we should merge.
There was a problem hiding this comment.
If you get rid of ObjectSpace, it's a big +1 for me and I'll merge it right away :)
There was a problem hiding this comment.
Looks like Rails::Engine.ancestors could replace searching ObjectSpace
|
@txus I've got something together, but tests are failing (even on a fresh clone)... |
|
@rthbound any luck? |
|
@txus looks like the failures are due to problems with the test itself and likely not to do with the implementation. Have not yet confirmed. |
Addresses #11 by generating an env.rb file that loads routes for any mounted engine and for the application itself (loads url_helpers for main_app and 'engine_name')
Warning, it's ugly... The thought of this code going into every spinach user's env.rb file grosses me out.
Perhaps it could be moved into the railties file...